package main

import (
	"bytes"
	"encoding/json"
	"fmt"
	"io/ioutil"
	"net/http"
)

func main() {

	url := "http://localhost:8888/v1/fin_task"
	method := "POST"

	in := &struct {
		Id    int    `json:"id"`
		Error string `json:"error"`
	}{
		Id:    9,
		Error: "",
	}
	b, _ := json.Marshal(in)
	payload := bytes.NewReader(b)

	client := &http.Client{}
	req, err := http.NewRequest(method, url, payload)

	if err != nil {
		fmt.Println(err)
		return
	}
	req.Header.Add("Content-Type", "application/json")

	res, err := client.Do(req)
	if err != nil {
		fmt.Println(err)
		return
	}
	defer res.Body.Close()

	body, err := ioutil.ReadAll(res.Body)
	if err != nil {
		fmt.Println(err)
		return
	}
	fmt.Println(string(body))
}
